// 缓存相关
const GT = key => window.sessionStorage.getItem(key)
const ST = (key, value) => window.sessionStorage.setItem(key, value)

export const _GT = (key, type = '{}') => JSON.parse(GT(key) || (ST(key, type) || type))
export const _ST = (key, value) => ST(key, JSON.stringify(value))

// 页面上报纪录缓存
export const getPageCache = () => _GT(`SXYJ_STAT_PAGE`)
export const setPageCache = value => _ST(`SXYJ_STAT_PAGE`, value)

// 节点上报纪录缓存
export const getNodeCache = path => _GT(`SXYJ_STAT_NODE-${path}`)
export const setNodeCache = (path, value) => _ST(`SXYJ_STAT_NODE-${path}`, value)